{include file="public/header" /}



<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.ds_groupbuy}</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>

    <form method="get" name="formSearch">
        <div class="ds-search-form">
            <dl>
                <dt>{$Think.lang.group_name}</dt>
                <dd><input type="text" value="{$Request.get.groupbuy_name}" name="groupbuy_name" id="groupbuy_name" class="txt" style="width:100px;"></dd>
            </dl>
            <dl>
                <dt>{$Think.lang.ds_store_name}</dt>
                <dd><input type="text" value="{$Request.get.store_name}" name="store_name" id="store_name" class="txt" style="width:100px;"></dd>
            </dl>
            <dl>
                <dt>{$Think.lang.groupbuy_index_state}</dt>
                <dd><select name="groupbuy_state" class="w90">
                        {notempty name="groupbuy_state_array"}
                        {foreach name="groupbuy_state_array" item="val"}
                        <option value="{$key}" {eq name="key" value="$Request.get.groupbuy_state" }selected{
                        /eq}>
                        {$val}</option>
                        {/foreach}
                        {/notempty}
                    </select>
                </dd>
            </dl>
            <div class="btn_group">
                <a href="javascript:document.formSearch.submit();" class="btn" title="{$Think.lang.ds_query}">{$Think.lang.ds_query}</a>
                {if $filtered}
                <a href="{:url('Groupbuy/index')}" class="btn btn-default" title="{$Think.lang.ds_cancel}">{$Think.lang.ds_cancel}</a>
                {/if}
            </div>
        </div>
    </form>
    <!--  说明 -->
    
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom">
            <h4 title="{$Think.lang.ds_explanation_tip}">{$Think.lang.ds_explanation}</h4>
            <span id="explanationZoom" title="{$Think.lang.ds_explanation_close}" class="arrow"></span>
        </div>
        <ul>
            <li>{$Think.lang.groupbuy_index_help1}</li>
        </ul>
    </div>
    
    
    <form id="list_form" method="post">
        <input type="hidden" id="group_id" name="group_id"/>
        <table class="ds-default-table">
            <thead>
            <tr class="thead">
                <th colspan="2">{$Think.lang.groupbuy_index_name}</th>
                <th class="align-center" width="120">{$Think.lang.ds_start_time}</th>
                <th class="align-center" width="120">{$Think.lang.ds_end_time}</th>
                <th class="align-center" width="80">{$Think.lang.groupbuy_index_click}</th>
                <th class="align-center" width="80">{$Think.lang.groupbuy_buy_quantity}</th>
                <th class="align-center" width="80">{$Think.lang.ds_recommend}</th>
                <th class="align-center" width="120">{$Think.lang.groupbuy_index_state}</th>
                <th class="align-center" width="150">{$Think.lang.ds_handle}</th>
            </tr>
            </thead>
            <tbody id="treet1">
            {notempty name="groupbuy_list"}
            {foreach name="groupbuy_list" item="val"}
            <tr class="hover">
                <td class="w60 picture">
                    <div class="size-56x56"><span class="thumb size-56x56"><i></i>
                        <a target="_blank" href="{:url('home/Showgroupbuy/groupbuy_detail',['group_id'=>$val.groupbuy_id])}"><img src="{:groupbuy_thumb($val.groupbuy_image)}" style=" max-width: 56px; max-height: 56px;"/></a></span></div>
                </td>
                <td class="group"><p>
                    <a target="_blank" href="{:url('home/Showgroupbuy/groupbuy_detail',['group_id'=>$val.groupbuy_id])}"> {$val.groupbuy_name}</a>
                </p>
                    <p class="goods">{$Think.lang.ds_goods_name}:<a target="_blank" href="{:url('home/Goods/index',['goods_id'=>$val.goods_id])}" title="{$val.goods_name}" target="_blank">{$val.goods_name}</a></p>
                    <p class="store">{$Think.lang.ds_store_name}:<a href="{:url('home/Store/index',['store_id'=>$val.store_id])}" title="{$val.store_name}" target="_blank">{$val.store_name}</a>
                    </p>
                </td>
                <td class="align-center nowarp">{$val.start_time_text}</td>
                <td class="align-center nowarp">{$val.end_time_text}</td>
                <td class="align-center">{$val.groupbuy_views}</td>
                <td class="align-center">{$val.groupbuy_buy_quantity}</td>
                <td class="yes-onoff align-center">
                    {eq name="val.groupbuy_recommended" value="0"}
                    <a href="JavaScript:void(0);" class=" disabled" ajax_branch='recommended' ds_type="inline_edit" fieldname="recommended" fieldid="{$val.groupbuy_id}" fieldvalue="0" title="{$Think.lang.ds_editable}">
                        <img src="{$Think.ADMIN_SITE_ROOT}/images/treetable/transparent.gif">
                    </a>
                    {else /}
                    <a href="JavaScript:void(0);" class=" enabled" ajax_branch='recommended' ds_type="inline_edit" fieldname="recommended" fieldid="{$val.groupbuy_id}" fieldvalue="1" title="{$Think.lang.ds_editable}">
                        <img src="{$Think.ADMIN_SITE_ROOT}/images/treetable/transparent.gif">
                    </a>
                    {/eq}
                <td class="align-center">{$val.groupbuy_state_text}</td>
                <td class="align-center" id="ds_row_{$val.groupbuy_id}">
                    {if $val.reviewable}
                    <a dstype="btn_review_pass" data-groupbuy-id="{$val.groupbuy_id}" href="javascript:;" class="dsui-btn-add"><i class="iconfont"></i>{$Think.lang.ds_pass}</a>
                    <a dstype="btn_review_fail" data-groupbuy-id="{$val.groupbuy_id}" href="javascript:;" class="dsui-btn-del"><i class="iconfont"></i>{$Think.lang.ds_refuse}</a>
                    {/if}
                    {if $val.cancelable}
                    <a dstype="btn_cancel" data-groupbuy-id="{$val.groupbuy_id}" href="javascript:;" class="dsui-btn-edit"><i class="iconfont"></i>{$Think.lang.ds_cancel}</a>
                    {/if}
                    <a href="javascript:dsLayerConfirm('{:url('Groupbuy/groupbuy_del',['groupbuy_id'=>$val.groupbuy_id])}','{$Think.lang.ensure_del}',{$val.groupbuy_id})" class="dsui-btn-del"><i class="iconfont"></i>{$Think.lang.ds_del}</a>
                </td>
            </tr>
            {/foreach}
            {else /}
            <tr class="no_data">
                <td colspan="16">{$Think.lang.ds_no_record}</td>
            </tr>
            {/notempty}
            </tbody>
        </table>
        {notempty name="groupbuy_list"}
        {$show_page|raw}
        {/notempty}
    </form>

</div>
<form id="op_form" action="" method="POST">
    <input type="hidden" id="groupbuy_id" name="groupbuy_id">
</form>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('[dstype="btn_review_pass"]').on('click', function () {
            var action = "{:url('Groupbuy/groupbuy_review_pass')}";
            var groupbuy_id = $(this).attr('data-groupbuy-id');
            layer.confirm('{$Think.lang.ensure_verify_success}', {
                btn: ['{$Think.lang.ds_ok}', '{$Think.lang.ds_cancel}'],
                title: false,
            }, function () {
                $('#op_form').attr('action', action);
                $('#groupbuy_id').val(groupbuy_id);
                $('#op_form').submit();
            });
        });

        $('[dstype="btn_review_fail"]').on('click', function () {
            var action = "{:url('Groupbuy/groupbuy_review_fail')}";
            var groupbuy_id = $(this).attr('data-groupbuy-id');
            layer.confirm('{$Think.lang.ensure_verify_fail}', {
                btn: ['{$Think.lang.ds_ok}', '{$Think.lang.ds_cancel}'],
                title: false,
            }, function () {
                $('#op_form').attr('action', action);
                $('#groupbuy_id').val(groupbuy_id);
                $('#op_form').submit();
            });
        });

        $('[dstype="btn_cancel"]').on('click', function () {
            var action = "{:url('Groupbuy/groupbuy_cancel')}";
            var groupbuy_id = $(this).attr('data-groupbuy-id');
            layer.confirm('{$Think.lang.ensure_close}', {
                btn: ['{$Think.lang.ds_ok}', '{$Think.lang.ds_cancel}'],
                title: false,
            }, function () {
                $('#op_form').attr('action', action);
                $('#groupbuy_id').val(groupbuy_id);
                $('#op_form').submit();
            });
        });
    });
</script>